package cn.rjzjh.tapestry.busi.model.ca;

// Generated 2014-9-6 10:25:55 by Hibernate Tools 4.0.0

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * CaGroup generated by hbm2java
 */
@Entity
@Table(name = "CA_Group")
public class CaGroup implements java.io.Serializable {

	private int id;
	private CaOrganization caOrganization;
	private String groupName;
	private Set<CaGroupStaff> caGroupStaffs = new HashSet<CaGroupStaff>(0);

	public CaGroup() {
	}

	public CaGroup(int id) {
		this.id = id;
	}

	public CaGroup(int id, String groupName) {
		this.id = id;
		this.groupName = groupName;
	}

	public CaGroup(int id, CaOrganization caOrganization, String groupName,
			Set<CaGroupStaff> caGroupStaffs) {
		this.id = id;
		this.caOrganization = caOrganization;
		this.groupName = groupName;
		this.caGroupStaffs = caGroupStaffs;
	}

	@Id()
	@Column(name = "id", unique = true, nullable = false, insertable = false, updatable = false)
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "orgId")
	public CaOrganization getCaOrganization() {
		return this.caOrganization;
	}

	public void setCaOrganization(CaOrganization caOrganization) {
		this.caOrganization = caOrganization;
	}

	@Column(name = "groupName", nullable = false, length = 100)
	public String getGroupName() {
		return this.groupName;
	}

	public void setGroupName(String groupName) {
		this.groupName = groupName;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "caGroup",cascade = { CascadeType.REMOVE })
	public Set<CaGroupStaff> getCaGroupStaffs() {
		return this.caGroupStaffs;
	}

	public void setCaGroupStaffs(Set<CaGroupStaff> caGroupStaffs) {
		this.caGroupStaffs = caGroupStaffs;
	}

}
